//
//  CommonMacro.h
//  Exam
//
//  Created by mll on 14-6-7.
//  Copyright (c) 2014年 Changzhou Jinzhineng Software Co., Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface CommonMacro : NSObject

#define kTableViewSeperatorColor    (0xf0f6f2)      // 通用tableview分隔符
#define kTableTitleColor            (0x333333)      // 列表通用标题颜色，接近黑色
#define kTableTitleGrayColor        (0x666666)      // 文字深灰
#define kFontColorGray              (0x999999)      // 文字浅灰
#define kLineColor                  (0xdcdcdc)      // 通用划线的颜色
#define kViewBgColor                (0xf4f4f4)      // 通用 viewcontroller.view 背景色
#define kChatBgColor                (0x42454e)
#define kCTBGrayColor               (0xe8e8e8)      // 通用 列表按下灰色
#define kCTBGreenColor              (0x4bbe73)      // 通用绿色
#define kCTBGreenHightlightColor    (0x198f43)      // 通用按下绿色
#define kTextFieldFont              (17.0f)             // 输入框通用字体大小

#define kNaviPanelBgColor           (0x327860)      // 导航面板背景
#define screenWidth [UIScreen mainScreen].bounds.size.width // 屏幕宽
#define screenHeight [UIScreen mainScreen].bounds.size.height // 屏幕高

#define kDefaultFontName @"Arial Rounded MT Bold"
#define kCommonFont ([UIFont fontWithName:@"Arial Rounded MT Bold" size:14.0])

#define IOS7_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending )
#define IOS6_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"6.0"] != NSOrderedAscending )
#define IOS5_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"5.0"] != NSOrderedAscending )
#define IOS4_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"4.0"] != NSOrderedAscending )
#define IOS3_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"3.0"] != NSOrderedAscending )

#pragma mark -
#pragma mark Frame Geometry

#define CENTER_VERTICALLY(parent,child) floor((parent.frame.size.height - child.frame.size.height) / 2)
#define CENTER_HORIZONTALLY(parent,child) floor((parent.frame.size.width - child.frame.size.width) / 2)

// example: [[UIView alloc] initWithFrame:(CGRect){CENTER_IN_PARENT(parentView,500,500),CGSizeMake(500,500)}];
#define CENTER_IN_PARENT(parent,childWidth,childHeight) CGPointMake(floor((parent.frame.size.width - childWidth) / 2),floor((parent.frame.size.height - childHeight) / 2))
#define CENTER_IN_PARENT_X(parent,childWidth) floor((parent.frame.size.width - childWidth) / 2)
#define CENTER_IN_PARENT_Y(parent,childHeight) floor((parent.frame.size.height - childHeight) / 2)


#define WIDTH(view) view.frame.size.width
#define HEIGHT(view) view.frame.size.height
#define X(view) view.frame.origin.x
#define Y(view) view.frame.origin.y
#define LEFT(view) view.frame.origin.x
#define TOP(view) view.frame.origin.y
#define BOTTOM(view) (view.frame.origin.y + view.frame.size.height)
#define RIGHT(view) (view.frame.origin.x + view.frame.size.width)
#define PAGE_SIZE (10);
@end
